Internal API Integration
You can programmatically manage and automate LicenseBox from your order management system or any other script using the internal helper file (which you can generate from your LicenseBox admin panel).
Note: The Internal API is designed to be used in your server-side order management system or some other PHP script only, you should never use the Internal API in your main product which you sell to your clients.
Getting Started
-
Log in to LicenseBox and create a new API Key of type 'Internal' from the API Settings Page.
-
Go to Internal Helper File generator from the Generate dropdown on the menu.
-
Select the API Key, API Language and then click Generate and copy the generated code.
-
Save the generated file as whatevar name you want to use in your script, we are going to use
lb_internal_helper.php
. So when you are done with this step you should have alb_internal_helper.php
file in your script root/includes folder. -
Go to your script and include the
lb_internal_helper.php
file as given below. -
At the very top paste the following code:
require_once 'includes/lb_internal_helper.php'; $api = new LicenseBoxInternalAPI();
Note: lb_internal_helper.php file on its own does nothing but it contains all the required function and you can call them however you want.
-
Now you can call any available Internal API function from your application, to learn more about all the available functions and what they do with live examples, add your generated Internal helper file code as
lb_internal_helper.php
file in theincludes
folder present insidelicensebox_api_usage_examples
folder and view theinternal_api_examples.php
file. -
For example you can add a new product in LicenseBox using
add_product()
function.
$res = $api->add_product("Test Product"); echo $res['message'];
-
You can also create a new license in LicenseBox using
create_license()
function.
$data = array( 'license_type' => 'Regular License', 'invoice_number' => '#98765', 'client_name' => 'John Snow', 'client_email' => 'jon@example.com', 'comments' => null, 'licensed_ips' => null, 'licensed_domains' => null, 'support_end_date' => null, 'updates_end_date' => null, 'expiry_date' => '2021-01-25 10:00', 'license_uses' => null, 'license_parallel_uses' => 1 ); $res = $api->create_license($product_id, $data); echo $res['message'];
-
You can also block a license using
block_license()
function.
$res = $api->block_license($license_code); echo $res['message'];
There are a lot more ways in which you can use LicenseBox Internal API, see the internal_api_examples.php
file inside licensebox_api_usage_examples
folder to learn more. If you are facing issues getting the integration to work, enable the Debug mode in the helper file by changing the LB_API_DEBUG
value to true
.
Internal API Documentation and Usage Examples
Internal API & helper file example (internal_api_examples.php)
You can check out the internal_api_examples.php file present in the licensebox_api_usage_examples
folder, it has all the LicenseBox external/client API functions documented with their usage and live examples. Add your generated internal helper file as lb_internal_helper.php
file in the includes
folder to test it out.
❮ Previous (External/Client API Integration) Next (FAQs) ❯
Please mail us your feedback at support@licensebox.app
Follow us on twitter at @LicenseBoxApp for future product updates